<div class="row" data-controller="slug-form seo-form">
  <div class="col-lg-8">
    <div class="card mb-4">
      <div class="card-body">
        <%= f.spree_text_field :title,
              required: true,
              autofocus: true,
              data: {
                seo_form_target: 'sourceTitleInput',
                slug_form_target: 'name',
                action: 'slug-form#updateUrlFromName'
              } %>

        <%= f.spree_rich_text_area :content,
              help_bubble: 'Add a summary of the post',
              data: { seo_form_target: 'sourceDescriptionInput' } %>

        <%= f.spree_rich_text_area :excerpt,
              help_bubble: 'Add a summary of the post',
              data: { seo_form_target: 'sourceExcerptInput' } %>
      </div>
    </div>
  </div>

  <div class="col-lg-4">
    <div class="card mb-4">
      <div class="card-body">
        <%= f.spree_file_field :image, width: 1200, height: 600, crop: true, css: 'flex-col', label: Spree.t(:featured_image) %>
      </div>
    </div>

    <div class="card mb-4">
      <div class="card-body">
        <%= f.spree_select :author_id, options_for_select(post_authors_select_options, @post.author_id || try_spree_current_user.id), { label: Spree.t(:author), autocomplete: true } %>
        <%= f.spree_select :post_category_id, options_for_select(@post_categories.pluck(:title, :id), @post.post_category_id), { label: Spree.t(:category), include_blank: true, autocomplete: true } %>
        <%= f.spree_datetime_field :published_at, help_bubble: 'Marks when the post will be published, leave it blank to hide it' %>

        <div class="form-group mb-0">
          <%= f.label :tag_list, Spree.t(:tags) %>
          <%= tom_select_tag 'post[tag_list]', multiple: true, class: 'w-100', options: post_tags_json_array, active_option: @post.tag_list, value_field: :name, create: true %>
        </div>
      </div>
    </div>

    <%= render 'spree/admin/shared/seo',
          f: f,
          title: @post.title,
          meta_title: @post.meta_title,
          description: @post.content,
          slug: @post.slug,
          slug_path: 'posts',
          placeholder: 'Add a title and content to see how this post might appear in a search engine listing' %>
  </div>
</div>